.class public Lcom/android/inputmethod/latin/CandidateView;
.super Landroid/view/View;
.source "CandidateView.java"


# static fields
.field private static final ADD_TO_USER_DICT_PREVIEW_DELAY:I = 0x7d0

.field private static final EMPTY_LIST:Ljava/util/List; = null
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/List",
            "<",
            "Ljava/lang/CharSequence;",
            ">;"
        }
    .end annotation
.end field

.field private static final MAX_SUGGESTIONS:I = 0x20

.field private static final MSG_REMOVE_PREVIEW:I = 0x1

.field private static final MSG_REMOVE_THROUGH_PREVIEW:I = 0x2

.field private static final NORMAL_PREVIEW_DELAY:I = 0x3c

.field private static final OUT_OF_BOUNDS:I = -0x1

.field private static final SCROLL_PIXELS:I = 0x14

.field private static final X_GAP:I = 0xa


# instance fields
.field private mBgPadding:Landroid/graphics/Rect;

.field private mColorNormal:I

.field private mColorOther:I

.field private mColorRecommended:I

.field private mCurrentWordIndex:I

.field private mDescent:I

.field private mDivider:Landroid/graphics/drawable/Drawable;

.field private mGestureDetector:Landroid/view/GestureDetector;

.field mHandler:Landroid/os/Handler;

.field private mHaveAutoTextSuggestion:Z

.field private mHaveMinimalSuggestion:Z

.field private mPaint:Landroid/graphics/Paint;

.field private mPopupPreviewX:I

.field private mPopupPreviewY:I

.field private mPreviewPopup:Landroid/widget/PopupWindow;

.field private mPreviewText:Landroid/widget/TextView;

.field private mScrolled:Z

.field private mSelectedIndex:I

.field private mSelectedString:Ljava/lang/CharSequence;

.field private mSelectionHighlight:Landroid/graphics/drawable/Drawable;

.field private mService:Lcom/android/inputmethod/latin/LatinIME;

.field private mShowingCompletions:Z

.field private mSuggestions:Ljava/util/List;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/List",
            "<",
            "Ljava/lang/CharSequence;",
            ">;"
        }
    .end annotation
.end field

.field private mTargetScrollX:I

.field private mTotalWidth:I

.field private mTouchX:I

.field private mTypedWordValid:Z

.field private mWordWidth:[I

.field private mWordX:[I


# direct methods
.method static constructor <clinit>()V
    .locals 1

    .prologue
    .line 45
    new-instance v0, Ljava/util/ArrayList;

    invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V

    sput-object v0, Lcom/android/inputmethod/latin/CandidateView;->EMPTY_LIST:Ljava/util/List;

    return-void
.end method

.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;)V
    .locals 7
    .parameter "context"
    .parameter "attrs"

    .prologue
    const/16 v2, 0x20

    const/4 v6, 0x1

    const/4 v5, -0x1

    const/4 v4, -0x2

    const/4 v3, 0x0

    .line 120
    invoke-direct {p0, p1, p2}, Landroid/view/View;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;)V

    .line 48
    sget-object v1, Lcom/android/inputmethod/latin/CandidateView;->EMPTY_LIST:Ljava/util/List;

    iput-object v1, p0, Lcom/android/inputmethod/latin/CandidateView;->mSuggestions:Ljava/util/List;

    .line 52
    iput v5, p0, Lcom/android/inputmethod/latin/CandidateView;->mTouchX:I

    .line 72
    new-array v1, v2, [I

    iput-object v1, p0, Lcom/android/inputmethod/latin/CandidateView;->mWordWidth:[I

    .line 73
    new-array v1, v2, [I

    iput-object v1, p0, Lcom/android/inputmethod/latin/CandidateView;->mWordX:[I

    .line 96
    new-instance v1, Lcom/android/inputmethod/latin/CandidateView$1;

    invoke-direct {v1, p0}, Lcom/android/inputmethod/latin/CandidateView$1;-><init>(Lcom/android/inputmethod/latin/CandidateView;)V

    iput-object v1, p0, Lcom/android/inputmethod/latin/CandidateView;->mHandler:Landroid/os/Handler;

    .line 121
    invoke-virtual {p1}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

    move-result-object v1

    const v2, 0x1080225

    invoke-virtual {v1, v2}, Landroid/content/res/Resources;->getDrawable(I)Landroid/graphics/drawable/Drawable;

    move-result-object v1

    iput-object v1, p0, Lcom/android/inputmethod/latin/CandidateView;->mSelectionHighlight:Landroid/graphics/drawable/Drawable;

    .line 124
    const-string v1, "layout_inflater"

    invoke-virtual {p1, v1}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/view/LayoutInflater;

    .line 127
    .local v0, inflate:Landroid/view/LayoutInflater;
    new-instance v1, Landroid/widget/PopupWindow;

    invoke-direct {v1, p1}, Landroid/widget/PopupWindow;-><init>(Landroid/content/Context;)V

    iput-object v1, p0, Lcom/android/inputmethod/latin/CandidateView;->mPreviewPopup:Landroid/widget/PopupWindow;

    .line 128
    const v1, 0x7f030001

    const/4 v2, 0x0

    invoke-virtual {v0, v1, v2}, Landroid/view/LayoutInflater;->inflate(ILandroid/view/ViewGroup;)Landroid/view/View;

    move-result-object v1

    check-cast v1, Landroid/widget/TextView;

    iput-object v1, p0, Lcom/android/inputmethod/latin/CandidateView;->mPreviewText:Landroid/widget/TextView;

    .line 129
    iget-object v1, p0, Lcom/android/inputmethod/latin/CandidateView;->mPreviewPopup:Landroid/widget/PopupWindow;

    invoke-virtual {v1, v4, v4}, Landroid/widget/PopupWindow;->setWindowLayoutMode(II)V

    .line 130
    iget-object v1, p0, Lcom/android/inputmethod/latin/CandidateView;->mPreviewPopup:Landroid/widget/PopupWindow;

    iget-object v2, p0, Lcom/android/inputmethod/latin/CandidateView;->mPreviewText:Landroid/widget/TextView;

    invoke-virtual {v1, v2}, Landroid/widget/PopupWindow;->setContentView(Landroid/view/View;)V

    .line 131
    iget-object v1, p0, Lcom/android/inputmethod/latin/CandidateView;->mPreviewPopup:Landroid/widget/PopupWindow;

    const/4 v2, 0x0

    invoke-virtual {v1, v2}, Landroid/widget/PopupWindow;->setBackgroundDrawable(Landroid/graphics/drawable/Drawable;)V

    .line 132
    invoke-virtual {p1}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

    move-result-object v1

    const/high16 v2, 0x7f08

    invoke-virtual {v1, v2}, Landroid/content/res/Resources;->getColor(I)I

    move-result v1

    iput v1, p0, Lcom/android/inputmethod/latin/CandidateView;->mColorNormal:I

    .line 133
    invoke-virtual {p1}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

    move-result-object v1

    const v2, 0x7f080001

    invoke-virtual {v1, v2}, Landroid/content/res/Resources;->getColor(I)I

    move-result v1

    iput v1, p0, Lcom/android/inputmethod/latin/CandidateView;->mColorRecommended:I

    .line 134
    invoke-virtual {p1}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

    move-result-object v1

    const v2, 0x7f080002

    invoke-virtual {v1, v2}, Landroid/content/res/Resources;->getColor(I)I

    move-result v1

    iput v1, p0, Lcom/android/inputmethod/latin/CandidateView;->mColorOther:I

    .line 135
    invoke-virtual {p1}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

    move-result-object v1

    const v2, 0x7f020029

    invoke-virtual {v1, v2}, Landroid/content/res/Resources;->getDrawable(I)Landroid/graphics/drawable/Drawable;

    move-result-object v1

    iput-object v1, p0, Lcom/android/inputmethod/latin/CandidateView;->mDivider:Landroid/graphics/drawable/Drawable;

    .line 137
    new-instance v1, Landroid/graphics/Paint;

    invoke-direct {v1}, Landroid/graphics/Paint;-><init>()V

    iput-object v1, p0, Lcom/android/inputmethod/latin/CandidateView;->mPaint:Landroid/graphics/Paint;

    .line 138
    iget-object v1, p0, Lcom/android/inputmethod/latin/CandidateView;->mPaint:Landroid/graphics/Paint;

    iget v2, p0, Lcom/android/inputmethod/latin/CandidateView;->mColorNormal:I

    invoke-virtual {v1, v2}, Landroid/graphics/Paint;->setColor(I)V

    .line 139
    iget-object v1, p0, Lcom/android/inputmethod/latin/CandidateView;->mPaint:Landroid/graphics/Paint;

    invoke-virtual {v1, v6}, Landroid/graphics/Paint;->setAntiAlias(Z)V

    .line 140
    iget-object v1, p0, Lcom/android/inputmethod/latin/CandidateView;->mPaint:Landroid/graphics/Paint;

    iget-object v2, p0, Lcom/android/inputmethod/latin/CandidateView;->mPreviewText:Landroid/widget/TextView;

    invoke-virtual {v2}, Landroid/widget/TextView;->getTextSize()F

    move-result v2

    invoke-virtual {v1, v2}, Landroid/graphics/Paint;->setTextSize(F)V

    .line 141
    iget-object v1, p0, Lcom/android/inputmethod/latin/CandidateView;->mPaint:Landroid/graphics/Paint;

    const/4 v2, 0x0

    invoke-virtual {v1, v2}, Landroid/graphics/Paint;->setStrokeWidth(F)V

    .line 142
    iget-object v1, p0, Lcom/android/inputmethod/latin/CandidateView;->mPaint:Landroid/graphics/Paint;

    invoke-virtual {v1}, Landroid/graphics/Paint;->descent()F

    move-result v1

    float-to-int v1, v1

    iput v1, p0, Lcom/android/inputmethod/latin/CandidateView;->mDescent:I

    .line 144
    new-instance v1, Landroid/view/GestureDetector;

    new-instance v2, Lcom/android/inputmethod/latin/CandidateView$2;

    invoke-direct {v2, p0}, Lcom/android/inputmethod/latin/CandidateView$2;-><init>(Lcom/android/inputmethod/latin/CandidateView;)V

    invoke-direct {v1, v2}, Landroid/view/GestureDetector;-><init>(Landroid/view/GestureDetector$OnGestureListener;)V

    iput-object v1, p0, Lcom/android/inputmethod/latin/CandidateView;->mGestureDetector:Landroid/view/GestureDetector;

    .line 172
    invoke-virtual {p0, v6}, Lcom/android/inputmethod/latin/CandidateView;->setHorizontalFadingEdgeEnabled(Z)V

    .line 173
    invoke-virtual {p0, v3}, Lcom/android/inputmethod/latin/CandidateView;->setWillNotDraw(Z)V

    .line 174
    invoke-virtual {p0, v3}, Lcom/android/inputmethod/latin/CandidateView;->setHorizontalScrollBarEnabled(Z)V

    .line 175
    invoke-virtual {p0, v3}, Lcom/android/inputmethod/latin/CandidateView;->setVerticalScrollBarEnabled(Z)V

    .line 176
    iput v3, p0, Lcom/android/inputmethod/latin/CandidateView;->mScrollX:I

    .line 179
    iput v5, p0, Lcom/android/inputmethod/latin/CandidateView;->mCurrentWordIndex:I

    .line 181
    return-void
.end method

.method static synthetic access$000(Lcom/android/inputmethod/latin/CandidateView;)Landroid/widget/TextView;
    .locals 1
    .parameter "x0"

    .prologue
    .line 42
    iget-object v0, p0, Lcom/android/inputmethod/latin/CandidateView;->mPreviewText:Landroid/widget/TextView;

    return-object v0
.end method

.method static synthetic access$100(Lcom/android/inputmethod/latin/CandidateView;)I
    .locals 1
    .parameter "x0"

    .prologue
    .line 42
    iget v0, p0, Lcom/android/inputmethod/latin/CandidateView;->mTouchX:I

    return v0
.end method

.method static synthetic access$1002(Lcom/android/inputmethod/latin/CandidateView;I)I
    .locals 0
    .parameter "x0"
    .parameter "x1"

    .prologue
    .line 42
    iput p1, p0, Lcom/android/inputmethod/latin/CandidateView;->mTargetScrollX:I

    return p1
.end method

.method static synthetic access$1100(Lcom/android/inputmethod/latin/CandidateView;)I
    .locals 1
    .parameter "x0"

    .prologue
    .line 42
    iget v0, p0, Lcom/android/inputmethod/latin/CandidateView;->mScrollX:I

    return v0
.end method

.method static synthetic access$1200(Lcom/android/inputmethod/latin/CandidateView;I)V
    .locals 0
    .parameter "x0"
    .parameter "x1"

    .prologue
    .line 42
    invoke-direct {p0, p1}, Lcom/android/inputmethod/latin/CandidateView;->hidePreview(I)V

    return-void
.end method

.method static synthetic access$200(Lcom/android/inputmethod/latin/CandidateView;)V
    .locals 0
    .parameter "x0"

    .prologue
    .line 42
    invoke-direct {p0}, Lcom/android/inputmethod/latin/CandidateView;->removeHighlight()V

    return-void
.end method

.method static synthetic access$302(Lcom/android/inputmethod/latin/CandidateView;Z)Z
    .locals 0
    .parameter "x0"
    .parameter "x1"

    .prologue
    .line 42
    iput-boolean p1, p0, Lcom/android/inputmethod/latin/CandidateView;->mScrolled:Z

    return p1
.end method

.method static synthetic access$412(Lcom/android/inputmethod/latin/CandidateView;I)I
    .locals 1
    .parameter "x0"
    .parameter "x1"

    .prologue
    .line 42
    iget v0, p0, Lcom/android/inputmethod/latin/CandidateView;->mScrollX:I

    add-int/2addr v0, p1

    iput v0, p0, Lcom/android/inputmethod/latin/CandidateView;->mScrollX:I

    return v0
.end method

.method static synthetic access$500(Lcom/android/inputmethod/latin/CandidateView;)I
    .locals 1
    .parameter "x0"

    .prologue
    .line 42
    iget v0, p0, Lcom/android/inputmethod/latin/CandidateView;->mScrollX:I

    return v0
.end method

.method static synthetic access$602(Lcom/android/inputmethod/latin/CandidateView;I)I
    .locals 0
    .parameter "x0"
    .parameter "x1"

    .prologue
    .line 42
    iput p1, p0, Lcom/android/inputmethod/latin/CandidateView;->mScrollX:I

    return p1
.end method

.method static synthetic access$700(Lcom/android/inputmethod/latin/CandidateView;)I
    .locals 1
    .parameter "x0"

    .prologue
    .line 42
    iget v0, p0, Lcom/android/inputmethod/latin/CandidateView;->mScrollX:I

    return v0
.end method

.method static synthetic access$800(Lcom/android/inputmethod/latin/CandidateView;)I
    .locals 1
    .parameter "x0"

    .prologue
    .line 42
    iget v0, p0, Lcom/android/inputmethod/latin/CandidateView;->mTotalWidth:I

    return v0
.end method

.method static synthetic access$920(Lcom/android/inputmethod/latin/CandidateView;I)I
    .locals 1
    .parameter "x0"
    .parameter "x1"

    .prologue
    .line 42
    iget v0, p0, Lcom/android/inputmethod/latin/CandidateView;->mScrollX:I

    sub-int/2addr v0, p1

    iput v0, p0, Lcom/android/inputmethod/latin/CandidateView;->mScrollX:I

    return v0
.end method

.method private hidePreview(I)V
    .locals 4
    .parameter "delay"

    .prologue
    .line 468
    const/4 v0, -0x1

    iput v0, p0, Lcom/android/inputmethod/latin/CandidateView;->mCurrentWordIndex:I

    .line 469
    iget-object v0, p0, Lcom/android/inputmethod/latin/CandidateView;->mPreviewPopup:Landroid/widget/PopupWindow;

    invoke-virtual {v0}, Landroid/widget/PopupWindow;->isShowing()Z

    move-result v0

    if-eqz v0, :cond_0

    .line 470
    iget-object v0, p0, Lcom/android/inputmethod/latin/CandidateView;->mHandler:Landroid/os/Handler;

    iget-object v1, p0, Lcom/android/inputmethod/latin/CandidateView;->mHandler:Landroid/os/Handler;

    const/4 v2, 0x1

    invoke-virtual {v1, v2}, Landroid/os/Handler;->obtainMessage(I)Landroid/os/Message;

    move-result-object v1

    int-to-long v2, p1

    invoke-virtual {v0, v1, v2, v3}, Landroid/os/Handler;->sendMessageDelayed(Landroid/os/Message;J)Z

    .line 473
    :cond_0
    return-void
.end method

.method private removeHighlight()V
    .locals 1

    .prologue
    .line 512
    const/4 v0, -0x1

    iput v0, p0, Lcom/android/inputmethod/latin/CandidateView;->mTouchX:I

    .line 513
    invoke-virtual {p0}, Lcom/android/inputmethod/latin/CandidateView;->invalidate()V

    .line 514
    return-void
.end method

.method private scrollToTarget()V
    .locals 2

    .prologue
    .line 283
    iget v0, p0, Lcom/android/inputmethod/latin/CandidateView;->mTargetScrollX:I

    iget v1, p0, Lcom/android/inputmethod/latin/CandidateView;->mScrollX:I

    if-le v0, v1, :cond_1

    .line 284
    iget v0, p0, Lcom/android/inputmethod/latin/CandidateView;->mScrollX:I

    add-int/lit8 v0, v0, 0x14

    iput v0, p0, Lcom/android/inputmethod/latin/CandidateView;->mScrollX:I

    .line 285
    iget v0, p0, Lcom/android/inputmethod/latin/CandidateView;->mScrollX:I

    iget v1, p0, Lcom/android/inputmethod/latin/CandidateView;->mTargetScrollX:I

    if-lt v0, v1, :cond_0

    .line 286
    iget v0, p0, Lcom/android/inputmethod/latin/CandidateView;->mTargetScrollX:I

    iput v0, p0, Lcom/android/inputmethod/latin/CandidateView;->mScrollX:I

    .line 287
    invoke-virtual {p0}, Lcom/android/inputmethod/latin/CandidateView;->requestLayout()V

    .line 296
    :cond_0
    :goto_0
    invoke-virtual {p0}, Lcom/android/inputmethod/latin/CandidateView;->invalidate()V

    .line 297
    return-void

    .line 290
    :cond_1
    iget v0, p0, Lcom/android/inputmethod/latin/CandidateView;->mScrollX:I

    const/16 v1, 0x14

    sub-int/2addr v0, v1

    iput v0, p0, Lcom/android/inputmethod/latin/CandidateView;->mScrollX:I

    .line 291
    iget v0, p0, Lcom/android/inputmethod/latin/CandidateView;->mScrollX:I

    iget v1, p0, Lcom/android/inputmethod/latin/CandidateView;->mTargetScrollX:I

    if-gt v0, v1, :cond_0

    .line 292
    iget v0, p0, Lcom/android/inputmethod/latin/CandidateView;->mTargetScrollX:I

    iput v0, p0, Lcom/android/inputmethod/latin/CandidateView;->mScrollX:I

    .line 293
    invoke-virtual {p0}, Lcom/android/inputmethod/latin/CandidateView;->requestLayout()V

    goto :goto_0
.end method

.method private showPreview(ILjava/lang/String;)V
    .locals 11
    .parameter "wordIndex"
    .parameter "altText"

    .prologue
    const/4 v9, 0x1

    const/4 v10, 0x0

    .line 476
    iget v1, p0, Lcom/android/inputmethod/latin/CandidateView;->mCurrentWordIndex:I

    .line 477
    .local v1, oldWordIndex:I
    iput p1, p0, Lcom/android/inputmethod/latin/CandidateView;->mCurrentWordIndex:I

    .line 479
    iget v6, p0, Lcom/android/inputmethod/latin/CandidateView;->mCurrentWordIndex:I

    if-ne v1, v6, :cond_0

    if-eqz p2, :cond_1

    .line 480
    :cond_0
    const/4 v6, -0x1

    if-ne p1, v6, :cond_2

    .line 481
    const/16 v6, 0x3c

    invoke-direct {p0, v6}, Lcom/android/inputmethod/latin/CandidateView;->hidePreview(I)V

    .line 509
    :cond_1
    :goto_0
    return-void

    .line 483
    :cond_2
    if-eqz p2, :cond_3

    move-object v4, p2

    .line 484
    .local v4, word:Ljava/lang/CharSequence;
    :goto_1
    iget-object v6, p0, Lcom/android/inputmethod/latin/CandidateView;->mPreviewText:Landroid/widget/TextView;

    invoke-virtual {v6, v4}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequence;)V

    .line 485
    iget-object v6, p0, Lcom/android/inputmethod/latin/CandidateView;->mPreviewText:Landroid/widget/TextView;

    invoke-static {v10, v10}, Landroid/view/View$MeasureSpec;->makeMeasureSpec(II)I

    move-result v7

    invoke-static {v10, v10}, Landroid/view/View$MeasureSpec;->makeMeasureSpec(II)I

    move-result v8

    invoke-virtual {v6, v7, v8}, Landroid/widget/TextView;->measure(II)V

    .line 487
    iget-object v6, p0, Lcom/android/inputmethod/latin/CandidateView;->mPaint:Landroid/graphics/Paint;

    invoke-interface {v4}, Ljava/lang/CharSequence;->length()I

    move-result v7

    invoke-virtual {v6, v4, v10, v7}, Landroid/graphics/Paint;->measureText(Ljava/lang/CharSequence;II)F

    move-result v6

    const/high16 v7, 0x41a0

    add-float/2addr v6, v7

    float-to-int v5, v6

    .line 488
    .local v5, wordWidth:I
    iget-object v6, p0, Lcom/android/inputmethod/latin/CandidateView;->mPreviewText:Landroid/widget/TextView;

    invoke-virtual {v6}, Landroid/widget/TextView;->getPaddingLeft()I

    move-result v6

    add-int/2addr v6, v5

    iget-object v7, p0, Lcom/android/inputmethod/latin/CandidateView;->mPreviewText:Landroid/widget/TextView;

    invoke-virtual {v7}, Landroid/widget/TextView;->getPaddingRight()I

    move-result v7

    add-int v3, v6, v7

    .line 490
    .local v3, popupWidth:I
    iget-object v6, p0, Lcom/android/inputmethod/latin/CandidateView;->mPreviewText:Landroid/widget/TextView;

    invoke-virtual {v6}, Landroid/widget/TextView;->getMeasuredHeight()I

    move-result v2

    .line 492
    .local v2, popupHeight:I
    iget-object v6, p0, Lcom/android/inputmethod/latin/CandidateView;->mWordX:[I

    aget v6, v6, p1

    iget-object v7, p0, Lcom/android/inputmethod/latin/CandidateView;->mPreviewText:Landroid/widget/TextView;

    invoke-virtual {v7}, Landroid/widget/TextView;->getPaddingLeft()I

    move-result v7

    sub-int/2addr v6, v7

    iget v7, p0, Lcom/android/inputmethod/latin/CandidateView;->mScrollX:I

    sub-int/2addr v6, v7

    iput v6, p0, Lcom/android/inputmethod/latin/CandidateView;->mPopupPreviewX:I

    .line 493
    neg-int v6, v2

    iput v6, p0, Lcom/android/inputmethod/latin/CandidateView;->mPopupPreviewY:I

    .line 494
    iget-object v6, p0, Lcom/android/inputmethod/latin/CandidateView;->mHandler:Landroid/os/Handler;

    invoke-virtual {v6, v9}, Landroid/os/Handler;->removeMessages(I)V

    .line 495
    const/4 v6, 0x2

    new-array v0, v6, [I

    .line 496
    .local v0, offsetInWindow:[I
    invoke-virtual {p0, v0}, Lcom/android/inputmethod/latin/CandidateView;->getLocationInWindow([I)V

    .line 497
    iget-object v6, p0, Lcom/android/inputmethod/latin/CandidateView;->mPreviewPopup:Landroid/widget/PopupWindow;

    invoke-virtual {v6}, Landroid/widget/PopupWindow;->isShowing()Z

    move-result v6

    if-eqz v6, :cond_4

    .line 498
    iget-object v6, p0, Lcom/android/inputmethod/latin/CandidateView;->mPreviewPopup:Landroid/widget/PopupWindow;

    iget v7, p0, Lcom/android/inputmethod/latin/CandidateView;->mPopupPreviewX:I

    iget v8, p0, Lcom/android/inputmethod/latin/CandidateView;->mPopupPreviewY:I

    aget v9, v0, v9

    add-int/2addr v8, v9

    invoke-virtual {v6, v7, v8, v3, v2}, Landroid/widget/PopupWindow;->update(IIII)V

    .line 506
    :goto_2
    iget-object v6, p0, Lcom/android/inputmethod/latin/CandidateView;->mPreviewText:Landroid/widget/TextView;

    invoke-virtual {v6, v10}, Landroid/widget/TextView;->setVisibility(I)V

    goto :goto_0

    .line 483
    .end local v0           #offsetInWindow:[I
    .end local v2           #popupHeight:I
    .end local v3           #popupWidth:I
    .end local v4           #word:Ljava/lang/CharSequence;
    .end local v5           #wordWidth:I
    :cond_3
    iget-object v6, p0, Lcom/android/inputmethod/latin/CandidateView;->mSuggestions:Ljava/util/List;

    invoke-interface {v6, p1}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v6

    check-cast v6, Ljava/lang/CharSequence;

    move-object v4, v6

    goto :goto_1

    .line 501
    .restart local v0       #offsetInWindow:[I
    .restart local v2       #popupHeight:I
    .restart local v3       #popupWidth:I
    .restart local v4       #word:Ljava/lang/CharSequence;
    .restart local v5       #wordWidth:I
    :cond_4
    iget-object v6, p0, Lcom/android/inputmethod/latin/CandidateView;->mPreviewPopup:Landroid/widget/PopupWindow;

    invoke-virtual {v6, v3}, Landroid/widget/PopupWindow;->setWidth(I)V

    .line 502
    iget-object v6, p0, Lcom/android/inputmethod/latin/CandidateView;->mPreviewPopup:Landroid/widget/PopupWindow;

    invoke-virtual {v6, v2}, Landroid/widget/PopupWindow;->setHeight(I)V

    .line 503
    iget-object v6, p0, Lcom/android/inputmethod/latin/CandidateView;->mPreviewPopup:Landroid/widget/PopupWindow;

    iget v7, p0, Lcom/android/inputmethod/latin/CandidateView;->mPopupPreviewX:I

    iget v8, p0, Lcom/android/inputmethod/latin/CandidateView;->mPopupPreviewY:I

    aget v9, v0, v9

    add-int/2addr v8, v9

    invoke-virtual {v6, p0, v10, v7, v8}, Landroid/widget/PopupWindow;->showAtLocation(Landroid/view/View;III)V

    goto :goto_2
.end method

.method private updateScrollPosition(I)V
    .locals 1
    .parameter "targetX"

    .prologue
    .line 356
    iget v0, p0, Lcom/android/inputmethod/latin/CandidateView;->mScrollX:I

    if-eq p1, v0, :cond_0

    .line 358
    iput p1, p0, Lcom/android/inputmethod/latin/CandidateView;->mTargetScrollX:I

    .line 359
    invoke-virtual {p0}, Lcom/android/inputmethod/latin/CandidateView;->requestLayout()V

    .line 360
    invoke-virtual {p0}, Lcom/android/inputmethod/latin/CandidateView;->invalidate()V

    .line 361
    const/4 v0, 0x1

    iput-boolean v0, p0, Lcom/android/inputmethod/latin/CandidateView;->mScrolled:Z

    .line 363
    :cond_0
    return-void
.end method


# virtual methods
.method public clear()V
    .locals 3

    .prologue
    const/4 v2, 0x0

    const/4 v1, -0x1

    .line 366
    sget-object v0, Lcom/android/inputmethod/latin/CandidateView;->EMPTY_LIST:Ljava/util/List;

    iput-object v0, p0, Lcom/android/inputmethod/latin/CandidateView;->mSuggestions:Ljava/util/List;

    .line 367
    iput v1, p0, Lcom/android/inputmethod/latin/CandidateView;->mTouchX:I

    .line 368
    const/4 v0, 0x0

    iput-object v0, p0, Lcom/android/inputmethod/latin/CandidateView;->mSelectedString:Ljava/lang/CharSequence;

    .line 369
    iput v1, p0, Lcom/android/inputmethod/latin/CandidateView;->mSelectedIndex:I

    .line 370
    invoke-virtual {p0}, Lcom/android/inputmethod/latin/CandidateView;->invalidate()V

    .line 371
    iget-object v0, p0, Lcom/android/inputmethod/latin/CandidateView;->mWordWidth:[I

    invoke-static {v0, v2}, Ljava/util/Arrays;->fill([II)V

    .line 372
    iget-object v0, p0, Lcom/android/inputmethod/latin/CandidateView;->mWordX:[I

    invoke-static {v0, v2}, Ljava/util/Arrays;->fill([II)V

    .line 373
    iget-object v0, p0, Lcom/android/inputmethod/latin/CandidateView;->mPreviewPopup:Landroid/widget/PopupWindow;

    invoke-virtual {v0}, Landroid/widget/PopupWindow;->isShowing()Z

    move-result v0

    if-eqz v0, :cond_0

    .line 374
    iget-object v0, p0, Lcom/android/inputmethod/latin/CandidateView;->mPreviewPopup:Landroid/widget/PopupWindow;

    invoke-virtual {v0}, Landroid/widget/PopupWindow;->dismiss()V

    .line 376
    :cond_0
    return-void
.end method

.method public computeHorizontalScrollRange()I
    .locals 1

    .prologue
    .line 193
    iget v0, p0, Lcom/android/inputmethod/latin/CandidateView;->mTotalWidth:I

    return v0
.end method

.method public getSuggestions()Ljava/util/List;
    .locals 1
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "()",
            "Ljava/util/List",
            "<",
            "Ljava/lang/CharSequence;",
            ">;"
        }
    .end annotation

    .prologue
    .line 319
    iget-object v0, p0, Lcom/android/inputmethod/latin/CandidateView;->mSuggestions:Ljava/util/List;

    return-object v0
.end method

.method public onDetachedFromWindow()V
    .locals 1

    .prologue
    .line 525
    invoke-super {p0}, Landroid/view/View;->onDetachedFromWindow()V

    .line 526
    const/16 v0, 0x3c

    invoke-direct {p0, v0}, Lcom/android/inputmethod/latin/CandidateView;->hidePreview(I)V

    .line 527
    return-void
.end method

.method protected onDraw(Landroid/graphics/Canvas;)V
    .locals 25
    .parameter "canvas"

    .prologue
    .line 202
    if-eqz p1, :cond_0

    .line 203
    invoke-super/range {p0 .. p1}, Landroid/view/View;->onDraw(Landroid/graphics/Canvas;)V

    .line 205
    :cond_0
    const/4 v5, 0x0

    move v0, v5

    move-object/from16 v1, p0

    iput v0, v1, Lcom/android/inputmethod/latin/CandidateView;->mTotalWidth:I

    .line 206
    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/android/inputmethod/latin/CandidateView;->mSuggestions:Ljava/util/List;

    move-object v5, v0

    if-nez v5, :cond_2

    .line 280
    :cond_1
    :goto_0
    return-void

    .line 208
    :cond_2
    invoke-virtual/range {p0 .. p0}, Lcom/android/inputmethod/latin/CandidateView;->getHeight()I

    move-result v14

    .line 209
    .local v14, height:I
    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/android/inputmethod/latin/CandidateView;->mBgPadding:Landroid/graphics/Rect;

    move-object v5, v0

    if-nez v5, :cond_4

    .line 210
    new-instance v5, Landroid/graphics/Rect;

    const/4 v6, 0x0

    const/4 v7, 0x0

    const/4 v8, 0x0

    const/4 v9, 0x0

    invoke-direct {v5, v6, v7, v8, v9}, Landroid/graphics/Rect;-><init>(IIII)V

    move-object v0, v5

    move-object/from16 v1, p0

    iput-object v0, v1, Lcom/android/inputmethod/latin/CandidateView;->mBgPadding:Landroid/graphics/Rect;

    .line 211
    invoke-virtual/range {p0 .. p0}, Lcom/android/inputmethod/latin/CandidateView;->getBackground()Landroid/graphics/drawable/Drawable;

    move-result-object v5

    if-eqz v5, :cond_3

    .line 212
    invoke-virtual/range {p0 .. p0}, Lcom/android/inputmethod/latin/CandidateView;->getBackground()Landroid/graphics/drawable/Drawable;

    move-result-object v5

    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/android/inputmethod/latin/CandidateView;->mBgPadding:Landroid/graphics/Rect;

    move-object v6, v0

    invoke-virtual {v5, v6}, Landroid/graphics/drawable/Drawable;->getPadding(Landroid/graphics/Rect;)Z

    .line 214
    :cond_3
    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/android/inputmethod/latin/CandidateView;->mDivider:Landroid/graphics/drawable/Drawable;

    move-object v5, v0

    const/4 v6, 0x0

    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/android/inputmethod/latin/CandidateView;->mBgPadding:Landroid/graphics/Rect;

    move-object v7, v0

    iget v7, v7, Landroid/graphics/Rect;->top:I

    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/android/inputmethod/latin/CandidateView;->mDivider:Landroid/graphics/drawable/Drawable;

    move-object v8, v0

    invoke-virtual {v8}, Landroid/graphics/drawable/Drawable;->getIntrinsicWidth()I

    move-result v8

    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/android/inputmethod/latin/CandidateView;->mDivider:Landroid/graphics/drawable/Drawable;

    move-object v9, v0

    invoke-virtual {v9}, Landroid/graphics/drawable/Drawable;->getIntrinsicHeight()I

    move-result v9

    invoke-virtual {v5, v6, v7, v8, v9}, Landroid/graphics/drawable/Drawable;->setBounds(IIII)V

    .line 217
    :cond_4
    const/16 v23, 0x0

    .line 218
    .local v23, x:I
    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/android/inputmethod/latin/CandidateView;->mSuggestions:Ljava/util/List;

    move-object v5, v0

    invoke-interface {v5}, Ljava/util/List;->size()I

    move-result v13

    .line 219
    .local v13, count:I
    invoke-virtual/range {p0 .. p0}, Lcom/android/inputmethod/latin/CandidateView;->getWidth()I

    move-result v21

    .line 220
    .local v21, width:I
    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/android/inputmethod/latin/CandidateView;->mBgPadding:Landroid/graphics/Rect;

    move-object v12, v0

    .line 221
    .local v12, bgPadding:Landroid/graphics/Rect;
    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/android/inputmethod/latin/CandidateView;->mPaint:Landroid/graphics/Paint;

    move-object v11, v0

    .line 222
    .local v11, paint:Landroid/graphics/Paint;
    move-object/from16 v0, p0

    iget v0, v0, Lcom/android/inputmethod/latin/CandidateView;->mTouchX:I

    move/from16 v19, v0

    .line 223
    .local v19, touchX:I
    move-object/from16 v0, p0

    iget v0, v0, Lcom/android/inputmethod/latin/CandidateView;->mScrollX:I

    move/from16 v16, v0

    .line 224
    .local v16, scrollX:I
    move-object/from16 v0, p0

    iget-boolean v0, v0, Lcom/android/inputmethod/latin/CandidateView;->mScrolled:Z

    move/from16 v17, v0

    .line 225
    .local v17, scrolled:Z
    move-object/from16 v0, p0

    iget-boolean v0, v0, Lcom/android/inputmethod/latin/CandidateView;->mTypedWordValid:Z

    move/from16 v20, v0

    .line 226
    .local v20, typedWordValid:Z
    int-to-float v5, v14

    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/android/inputmethod/latin/CandidateView;->mPaint:Landroid/graphics/Paint;

    move-object v6, v0

    invoke-virtual {v6}, Landroid/graphics/Paint;->getTextSize()F

    move-result v6

    add-float/2addr v5, v6

    move-object/from16 v0, p0

    iget v0, v0, Lcom/android/inputmethod/latin/CandidateView;->mDescent:I

    move v6, v0

    int-to-float v6, v6

    sub-float/2addr v5, v6

    float-to-int v5, v5

    div-int/lit8 v24, v5, 0x2

    .line 228
    .local v24, y:I
    const/4 v15, 0x0

    .local v15, i:I
    :goto_1
    if-ge v15, v13, :cond_f

    .line 229
    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/android/inputmethod/latin/CandidateView;->mSuggestions:Ljava/util/List;

    move-object v5, v0

    invoke-interface {v5, v15}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v6

    check-cast v6, Ljava/lang/CharSequence;

    .line 230
    .local v6, suggestion:Ljava/lang/CharSequence;
    if-nez v6, :cond_5

    .line 228
    .end local v6           #suggestion:Ljava/lang/CharSequence;
    :goto_2
    add-int/lit8 v15, v15, 0x1

    goto :goto_1

    .line 231
    .restart local v6       #suggestion:Ljava/lang/CharSequence;
    :cond_5
    move-object/from16 v0, p0

    iget v0, v0, Lcom/android/inputmethod/latin/CandidateView;->mColorNormal:I

    move v5, v0

    invoke-virtual {v11, v5}, Landroid/graphics/Paint;->setColor(I)V

    .line 233
    move-object/from16 v0, p0

    iget-boolean v0, v0, Lcom/android/inputmethod/latin/CandidateView;->mHaveAutoTextSuggestion:Z

    move v5, v0

    if-eqz v5, :cond_6

    const/4 v5, 0x1

    if-ne v15, v5, :cond_6

    if-eqz v20, :cond_8

    :cond_6
    move-object/from16 v0, p0

    iget-boolean v0, v0, Lcom/android/inputmethod/latin/CandidateView;->mHaveMinimalSuggestion:Z

    move v5, v0

    if-eqz v5, :cond_7

    const/4 v5, 0x1

    if-ne v15, v5, :cond_7

    if-eqz v20, :cond_8

    :cond_7
    move-object/from16 v0, p0

    iget-boolean v0, v0, Lcom/android/inputmethod/latin/CandidateView;->mHaveMinimalSuggestion:Z

    move v5, v0

    if-eqz v5, :cond_d

    if-nez v15, :cond_d

    if-eqz v20, :cond_d

    .line 237
    :cond_8
    sget-object v5, Landroid/graphics/Typeface;->DEFAULT_BOLD:Landroid/graphics/Typeface;

    invoke-virtual {v11, v5}, Landroid/graphics/Paint;->setTypeface(Landroid/graphics/Typeface;)Landroid/graphics/Typeface;

    .line 238
    move-object/from16 v0, p0

    iget v0, v0, Lcom/android/inputmethod/latin/CandidateView;->mColorRecommended:I

    move v5, v0

    invoke-virtual {v11, v5}, Landroid/graphics/Paint;->setColor(I)V

    .line 243
    :cond_9
    :goto_3
    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/android/inputmethod/latin/CandidateView;->mWordWidth:[I

    move-object v5, v0

    aget v5, v5, v15

    if-eqz v5, :cond_e

    .line 244
    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/android/inputmethod/latin/CandidateView;->mWordWidth:[I

    move-object v5, v0

    aget v22, v5, v15

    .line 251
    .local v22, wordWidth:I
    :goto_4
    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/android/inputmethod/latin/CandidateView;->mWordX:[I

    move-object v5, v0

    aput v23, v5, v15

    .line 253
    add-int v5, v19, v16

    move v0, v5

    move/from16 v1, v23

    if-lt v0, v1, :cond_b

    add-int v5, v19, v16

    add-int v7, v23, v22

    if-ge v5, v7, :cond_b

    if-nez v17, :cond_b

    const/4 v5, -0x1

    move/from16 v0, v19

    move v1, v5

    if-eq v0, v1, :cond_b

    .line 255
    if-eqz p1, :cond_a

    .line 256
    move/from16 v0, v23

    int-to-float v0, v0

    move v5, v0

    const/4 v7, 0x0

    move-object/from16 v0, p1

    move v1, v5

    move v2, v7

    invoke-virtual {v0, v1, v2}, Landroid/graphics/Canvas;->translate(FF)V

    .line 257
    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/android/inputmethod/latin/CandidateView;->mSelectionHighlight:Landroid/graphics/drawable/Drawable;

    move-object v5, v0

    const/4 v7, 0x0

    iget v8, v12, Landroid/graphics/Rect;->top:I

    move-object v0, v5

    move v1, v7

    move v2, v8

    move/from16 v3, v22

    move v4, v14

    invoke-virtual {v0, v1, v2, v3, v4}, Landroid/graphics/drawable/Drawable;->setBounds(IIII)V

    .line 258
    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/android/inputmethod/latin/CandidateView;->mSelectionHighlight:Landroid/graphics/drawable/Drawable;

    move-object v5, v0

    move-object v0, v5

    move-object/from16 v1, p1

    invoke-virtual {v0, v1}, Landroid/graphics/drawable/Drawable;->draw(Landroid/graphics/Canvas;)V

    .line 259
    move/from16 v0, v23

    neg-int v0, v0

    move v5, v0

    int-to-float v5, v5

    const/4 v7, 0x0

    move-object/from16 v0, p1

    move v1, v5

    move v2, v7

    invoke-virtual {v0, v1, v2}, Landroid/graphics/Canvas;->translate(FF)V

    .line 260
    const/4 v5, 0x0

    move-object/from16 v0, p0

    move v1, v15

    move-object v2, v5

    invoke-direct {v0, v1, v2}, Lcom/android/inputmethod/latin/CandidateView;->showPreview(ILjava/lang/String;)V

    .line 262
    :cond_a
    move-object v0, v6

    move-object/from16 v1, p0

    iput-object v0, v1, Lcom/android/inputmethod/latin/CandidateView;->mSelectedString:Ljava/lang/CharSequence;

    .line 263
    move v0, v15

    move-object/from16 v1, p0

    iput v0, v1, Lcom/android/inputmethod/latin/CandidateView;->mSelectedIndex:I

    .line 266
    :cond_b
    if-eqz p1, :cond_c

    .line 267
    const/4 v7, 0x0

    invoke-interface {v6}, Ljava/lang/CharSequence;->length()I

    move-result v8

    add-int/lit8 v5, v23, 0xa

    int-to-float v9, v5

    move/from16 v0, v24

    int-to-float v0, v0

    move v10, v0

    move-object/from16 v5, p1

    invoke-virtual/range {v5 .. v11}, Landroid/graphics/Canvas;->drawText(Ljava/lang/CharSequence;IIFFLandroid/graphics/Paint;)V

    .line 268
    move-object/from16 v0, p0

    iget v0, v0, Lcom/android/inputmethod/latin/CandidateView;->mColorOther:I

    move v5, v0

    invoke-virtual {v11, v5}, Landroid/graphics/Paint;->setColor(I)V

    .line 269
    add-int v5, v23, v22

    int-to-float v5, v5

    const/4 v6, 0x0

    move-object/from16 v0, p1

    move v1, v5

    move v2, v6

    invoke-virtual {v0, v1, v2}, Landroid/graphics/Canvas;->translate(FF)V

    .line 270
    .end local v6           #suggestion:Ljava/lang/CharSequence;
    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/android/inputmethod/latin/CandidateView;->mDivider:Landroid/graphics/drawable/Drawable;

    move-object v5, v0

    move-object v0, v5

    move-object/from16 v1, p1

    invoke-virtual {v0, v1}, Landroid/graphics/drawable/Drawable;->draw(Landroid/graphics/Canvas;)V

    .line 271
    move/from16 v0, v23

    neg-int v0, v0

    move v5, v0

    sub-int v5, v5, v22

    int-to-float v5, v5

    const/4 v6, 0x0

    move-object/from16 v0, p1

    move v1, v5

    move v2, v6

    invoke-virtual {v0, v1, v2}, Landroid/graphics/Canvas;->translate(FF)V

    .line 273
    :cond_c
    sget-object v5, Landroid/graphics/Typeface;->DEFAULT:Landroid/graphics/Typeface;

    invoke-virtual {v11, v5}, Landroid/graphics/Paint;->setTypeface(Landroid/graphics/Typeface;)Landroid/graphics/Typeface;

    .line 274
    add-int v23, v23, v22

    goto/16 :goto_2

    .line 239
    .end local v22           #wordWidth:I
    .restart local v6       #suggestion:Ljava/lang/CharSequence;
    :cond_d
    if-eqz v15, :cond_9

    .line 240
    move-object/from16 v0, p0

    iget v0, v0, Lcom/android/inputmethod/latin/CandidateView;->mColorOther:I

    move v5, v0

    invoke-virtual {v11, v5}, Landroid/graphics/Paint;->setColor(I)V

    goto/16 :goto_3

    .line 246
    :cond_e
    const/4 v5, 0x0

    invoke-interface {v6}, Ljava/lang/CharSequence;->length()I

    move-result v7

    invoke-virtual {v11, v6, v5, v7}, Landroid/graphics/Paint;->measureText(Ljava/lang/CharSequence;II)F

    move-result v18

    .line 247
    .local v18, textWidth:F
    move/from16 v0, v18

    float-to-int v0, v0

    move v5, v0

    add-int/lit8 v22, v5, 0x14

    .line 248
    .restart local v22       #wordWidth:I
    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/android/inputmethod/latin/CandidateView;->mWordWidth:[I

    move-object v5, v0

    aput v22, v5, v15

    goto/16 :goto_4

    .line 276
    .end local v6           #suggestion:Ljava/lang/CharSequence;
    .end local v18           #textWidth:F
    .end local v22           #wordWidth:I
    :cond_f
    move/from16 v0, v23

    move-object/from16 v1, p0

    iput v0, v1, Lcom/android/inputmethod/latin/CandidateView;->mTotalWidth:I

    .line 277
    move-object/from16 v0, p0

    iget v0, v0, Lcom/android/inputmethod/latin/CandidateView;->mTargetScrollX:I

    move v5, v0

    move-object/from16 v0, p0

    iget v0, v0, Lcom/android/inputmethod/latin/CandidateView;->mScrollX:I

    move v6, v0

    if-eq v5, v6, :cond_1

    .line 278
    invoke-direct/range {p0 .. p0}, Lcom/android/inputmethod/latin/CandidateView;->scrollToTarget()V

    goto/16 :goto_0
.end method

.method public onTouchEvent(Landroid/view/MotionEvent;)Z
    .locals 13
    .parameter "me"

    .prologue
    const/4 v12, 0x0

    const/4 v11, -0x1

    const/4 v10, 0x1

    const/4 v9, 0x0

    .line 381
    iget-object v6, p0, Lcom/android/inputmethod/latin/CandidateView;->mGestureDetector:Landroid/view/GestureDetector;

    invoke-virtual {v6, p1}, Landroid/view/GestureDetector;->onTouchEvent(Landroid/view/MotionEvent;)Z

    move-result v6

    if-eqz v6, :cond_0

    move v6, v10

    .line 445
    :goto_0
    return v6

    .line 385
    :cond_0
    invoke-virtual {p1}, Landroid/view/MotionEvent;->getAction()I

    move-result v0

    .line 386
    .local v0, action:I
    invoke-virtual {p1}, Landroid/view/MotionEvent;->getX()F

    move-result v6

    float-to-int v4, v6

    .line 387
    .local v4, x:I
    invoke-virtual {p1}, Landroid/view/MotionEvent;->getY()F

    move-result v6

    float-to-int v5, v6

    .line 388
    .local v5, y:I
    iput v4, p0, Lcom/android/inputmethod/latin/CandidateView;->mTouchX:I

    .line 390
    packed-switch v0, :pswitch_data_0

    :goto_1
    move v6, v10

    .line 445
    goto :goto_0

    .line 392
    :pswitch_0
    iput-boolean v9, p0, Lcom/android/inputmethod/latin/CandidateView;->mScrolled:Z

    .line 393
    invoke-virtual {p0}, Lcom/android/inputmethod/latin/CandidateView;->invalidate()V

    goto :goto_1

    .line 396
    :pswitch_1
    if-gtz v5, :cond_2

    .line 398
    iget-object v6, p0, Lcom/android/inputmethod/latin/CandidateView;->mSelectedString:Ljava/lang/CharSequence;

    if-eqz v6, :cond_2

    .line 399
    iget-boolean v6, p0, Lcom/android/inputmethod/latin/CandidateView;->mShowingCompletions:Z

    if-nez v6, :cond_1

    .line 400
    iget-object v6, p0, Lcom/android/inputmethod/latin/CandidateView;->mSuggestions:Ljava/util/List;

    invoke-interface {v6, v9}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v6

    check-cast v6, Ljava/lang/CharSequence;

    iget-object v7, p0, Lcom/android/inputmethod/latin/CandidateView;->mSelectedString:Ljava/lang/CharSequence;

    invoke-static {v6, v7}, Lcom/android/inputmethod/latin/TextEntryState;->acceptedSuggestion(Ljava/lang/CharSequence;Ljava/lang/CharSequence;)V

    .line 403
    :cond_1
    iget-object v6, p0, Lcom/android/inputmethod/latin/CandidateView;->mService:Lcom/android/inputmethod/latin/LatinIME;

    iget v7, p0, Lcom/android/inputmethod/latin/CandidateView;->mSelectedIndex:I

    iget-object v8, p0, Lcom/android/inputmethod/latin/CandidateView;->mSelectedString:Ljava/lang/CharSequence;

    invoke-virtual {v6, v7, v8}, Lcom/android/inputmethod/latin/LatinIME;->pickSuggestionManually(ILjava/lang/CharSequence;)V

    .line 404
    iput-object v12, p0, Lcom/android/inputmethod/latin/CandidateView;->mSelectedString:Ljava/lang/CharSequence;

    .line 405
    iput v11, p0, Lcom/android/inputmethod/latin/CandidateView;->mSelectedIndex:I

    .line 408
    :cond_2
    invoke-virtual {p0}, Lcom/android/inputmethod/latin/CandidateView;->invalidate()V

    goto :goto_1

    .line 411
    :pswitch_2
    const/16 v1, 0x3c

    .line 412
    .local v1, delay:I
    iget-boolean v6, p0, Lcom/android/inputmethod/latin/CandidateView;->mScrolled:Z

    if-nez v6, :cond_5

    .line 413
    iget-object v6, p0, Lcom/android/inputmethod/latin/CandidateView;->mSelectedString:Ljava/lang/CharSequence;

    if-eqz v6, :cond_5

    .line 414
    iget-boolean v6, p0, Lcom/android/inputmethod/latin/CandidateView;->mShowingCompletions:Z

    if-nez v6, :cond_3

    .line 415
    iget-object v6, p0, Lcom/android/inputmethod/latin/CandidateView;->mSuggestions:Ljava/util/List;

    invoke-interface {v6, v9}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v6

    check-cast v6, Ljava/lang/CharSequence;

    iget-object v7, p0, Lcom/android/inputmethod/latin/CandidateView;->mSelectedString:Ljava/lang/CharSequence;

    invoke-static {v6, v7}, Lcom/android/inputmethod/latin/TextEntryState;->acceptedSuggestion(Ljava/lang/CharSequence;Ljava/lang/CharSequence;)V

    .line 420
    :cond_3
    const/4 v2, 0x0

    .line 421
    .local v2, showPreview:Z
    const/4 v3, 0x0

    .line 422
    .local v3, word:Ljava/lang/CharSequence;
    iget-object v6, p0, Lcom/android/inputmethod/latin/CandidateView;->mSuggestions:Ljava/util/List;

    invoke-interface {v6}, Ljava/util/List;->size()I

    move-result v6

    if-lez v6, :cond_4

    .line 423
    invoke-virtual {p1}, Landroid/view/MotionEvent;->getX()F

    move-result v6

    iget v7, p0, Lcom/android/inputmethod/latin/CandidateView;->mScrollX:I

    int-to-float v7, v7

    add-float/2addr v6, v7

    iget-object v7, p0, Lcom/android/inputmethod/latin/CandidateView;->mWordWidth:[I

    aget v7, v7, v9

    int-to-float v7, v7

    cmpg-float v6, v6, v7

    if-gez v6, :cond_4

    iget v6, p0, Lcom/android/inputmethod/latin/CandidateView;->mScrollX:I

    const/16 v7, 0xa

    if-ge v6, v7, :cond_4

    .line 424
    iget-object v6, p0, Lcom/android/inputmethod/latin/CandidateView;->mSuggestions:Ljava/util/List;

    invoke-interface {v6, v9}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v3

    .end local v3           #word:Ljava/lang/CharSequence;
    check-cast v3, Ljava/lang/CharSequence;

    .line 425
    .restart local v3       #word:Ljava/lang/CharSequence;
    iget-boolean v6, p0, Lcom/android/inputmethod/latin/CandidateView;->mTypedWordValid:Z

    if-nez v6, :cond_4

    iget-object v6, p0, Lcom/android/inputmethod/latin/CandidateView;->mService:Lcom/android/inputmethod/latin/LatinIME;

    invoke-virtual {v3}, Ljava/lang/Object;->toString()Ljava/lang/String;

    move-result-object v7

    invoke-virtual {v6, v7}, Lcom/android/inputmethod/latin/LatinIME;->addWordToDictionary(Ljava/lang/String;)Z

    move-result v6

    if-eqz v6, :cond_4

    .line 426
    const/4 v2, 0x1

    .line 430
    :cond_4
    iget-object v6, p0, Lcom/android/inputmethod/latin/CandidateView;->mService:Lcom/android/inputmethod/latin/LatinIME;

    iget v7, p0, Lcom/android/inputmethod/latin/CandidateView;->mSelectedIndex:I

    iget-object v8, p0, Lcom/android/inputmethod/latin/CandidateView;->mSelectedString:Ljava/lang/CharSequence;

    invoke-virtual {v6, v7, v8}, Lcom/android/inputmethod/latin/LatinIME;->pickSuggestionManually(ILjava/lang/CharSequence;)V

    .line 431
    if-eqz v2, :cond_5

    .line 432
    invoke-virtual {p0}, Lcom/android/inputmethod/latin/CandidateView;->getContext()Landroid/content/Context;

    move-result-object v6

    invoke-virtual {v6}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

    move-result-object v6

    const v7, 0x7f0a0026

    new-array v8, v10, [Ljava/lang/Object;

    aput-object v3, v8, v9

    invoke-virtual {v6, v7, v8}, Landroid/content/res/Resources;->getString(I[Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v6

    invoke-direct {p0, v9, v6}, Lcom/android/inputmethod/latin/CandidateView;->showPreview(ILjava/lang/String;)V

    .line 433
    const/16 v1, 0x7d0

    .line 438
    .end local v2           #showPreview:Z
    .end local v3           #word:Ljava/lang/CharSequence;
    :cond_5
    iput-object v12, p0, Lcom/android/inputmethod/latin/CandidateView;->mSelectedString:Ljava/lang/CharSequence;

    .line 439
    iput v11, p0, Lcom/android/inputmethod/latin/CandidateView;->mSelectedIndex:I

    .line 440
    invoke-direct {p0}, Lcom/android/inputmethod/latin/CandidateView;->removeHighlight()V

    .line 441
    invoke-direct {p0, v1}, Lcom/android/inputmethod/latin/CandidateView;->hidePreview(I)V

    .line 442
    invoke-virtual {p0}, Lcom/android/inputmethod/latin/CandidateView;->requestLayout()V

    goto/16 :goto_1

    .line 390
    :pswitch_data_0
    .packed-switch 0x0
        :pswitch_0
        :pswitch_2
        :pswitch_1
    .end packed-switch
.end method

.method public scrollNext()V
    .locals 7

    .prologue
    .line 340
    const/4 v1, 0x0

    .line 341
    .local v1, i:I
    iget v3, p0, Lcom/android/inputmethod/latin/CandidateView;->mScrollX:I

    .line 342
    .local v3, targetX:I
    iget-object v4, p0, Lcom/android/inputmethod/latin/CandidateView;->mSuggestions:Ljava/util/List;

    invoke-interface {v4}, Ljava/util/List;->size()I

    move-result v0

    .line 343
    .local v0, count:I
    iget v4, p0, Lcom/android/inputmethod/latin/CandidateView;->mScrollX:I

    invoke-virtual {p0}, Lcom/android/inputmethod/latin/CandidateView;->getWidth()I

    move-result v5

    add-int v2, v4, v5

    .line 344
    .local v2, rightEdge:I
    :goto_0
    if-ge v1, v0, :cond_0

    .line 345
    iget-object v4, p0, Lcom/android/inputmethod/latin/CandidateView;->mWordX:[I

    aget v4, v4, v1

    if-gt v4, v2, :cond_1

    iget-object v4, p0, Lcom/android/inputmethod/latin/CandidateView;->mWordX:[I

    aget v4, v4, v1

    iget-object v5, p0, Lcom/android/inputmethod/latin/CandidateView;->mWordWidth:[I

    aget v5, v5, v1

    add-int/2addr v4, v5

    if-lt v4, v2, :cond_1

    .line 347
    iget-object v4, p0, Lcom/android/inputmethod/latin/CandidateView;->mWordX:[I

    aget v4, v4, v1

    iget v5, p0, Lcom/android/inputmethod/latin/CandidateView;->mTotalWidth:I

    invoke-virtual {p0}, Lcom/android/inputmethod/latin/CandidateView;->getWidth()I

    move-result v6

    sub-int/2addr v5, v6

    invoke-static {v4, v5}, Ljava/lang/Math;->min(II)I

    move-result v3

    .line 352
    :cond_0
    invoke-direct {p0, v3}, Lcom/android/inputmethod/latin/CandidateView;->updateScrollPosition(I)V

    .line 353
    return-void

    .line 350
    :cond_1
    add-int/lit8 v1, v1, 0x1

    goto :goto_0
.end method

.method public scrollPrev()V
    .locals 7

    .prologue
    .line 323
    const/4 v2, 0x0

    .line 324
    .local v2, i:I
    iget-object v4, p0, Lcom/android/inputmethod/latin/CandidateView;->mSuggestions:Ljava/util/List;

    invoke-interface {v4}, Ljava/util/List;->size()I

    move-result v0

    .line 325
    .local v0, count:I
    const/4 v1, 0x0

    .line 326
    .local v1, firstItem:I
    :goto_0
    if-ge v2, v0, :cond_0

    .line 327
    iget-object v4, p0, Lcom/android/inputmethod/latin/CandidateView;->mWordX:[I

    aget v4, v4, v2

    iget v5, p0, Lcom/android/inputmethod/latin/CandidateView;->mScrollX:I

    if-ge v4, v5, :cond_2

    iget-object v4, p0, Lcom/android/inputmethod/latin/CandidateView;->mWordX:[I

    aget v4, v4, v2

    iget-object v5, p0, Lcom/android/inputmethod/latin/CandidateView;->mWordWidth:[I

    aget v5, v5, v2

    add-int/2addr v4, v5

    iget v5, p0, Lcom/android/inputmethod/latin/CandidateView;->mScrollX:I

    const/4 v6, 0x1

    sub-int/2addr v5, v6

    if-lt v4, v5, :cond_2

    .line 329
    move v1, v2

    .line 334
    :cond_0
    iget-object v4, p0, Lcom/android/inputmethod/latin/CandidateView;->mWordX:[I

    aget v4, v4, v1

    iget-object v5, p0, Lcom/android/inputmethod/latin/CandidateView;->mWordWidth:[I

    aget v5, v5, v1

    add-int/2addr v4, v5

    invoke-virtual {p0}, Lcom/android/inputmethod/latin/CandidateView;->getWidth()I

    move-result v5

    sub-int v3, v4, v5

    .line 335
    .local v3, leftEdge:I
    if-gez v3, :cond_1

    const/4 v3, 0x0

    .line 336
    :cond_1
    invoke-direct {p0, v3}, Lcom/android/inputmethod/latin/CandidateView;->updateScrollPosition(I)V

    .line 337
    return-void

    .line 332
    .end local v3           #leftEdge:I
    :cond_2
    add-int/lit8 v2, v2, 0x1

    goto :goto_0
.end method

.method public setService(Lcom/android/inputmethod/latin/LatinIME;)V
    .locals 0
    .parameter "listener"

    .prologue
    .line 188
    iput-object p1, p0, Lcom/android/inputmethod/latin/CandidateView;->mService:Lcom/android/inputmethod/latin/LatinIME;

    .line 189
    return-void
.end method

.method public setSuggestions(Ljava/util/List;ZZZZ)V
    .locals 2
    .parameter
    .parameter "completions"
    .parameter "typedWordValid"
    .parameter "haveMinimalSuggestion"
    .parameter "haveAutoTextSuggestion"
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Ljava/util/List",
            "<",
            "Ljava/lang/CharSequence;",
            ">;ZZZZ)V"
        }
    .end annotation

    .prologue
    .local p1, suggestions:Ljava/util/List;,"Ljava/util/List<Ljava/lang/CharSequence;>;"
    const/4 v1, 0x0

    .line 301
    invoke-virtual {p0}, Lcom/android/inputmethod/latin/CandidateView;->clear()V

    .line 302
    if-eqz p1, :cond_0

    .line 303
    new-instance v0, Ljava/util/ArrayList;

    invoke-direct {v0, p1}, Ljava/util/ArrayList;-><init>(Ljava/util/Collection;)V

    iput-object v0, p0, Lcom/android/inputmethod/latin/CandidateView;->mSuggestions:Ljava/util/List;

    .line 305
    :cond_0
    iput-boolean p2, p0, Lcom/android/inputmethod/latin/CandidateView;->mShowingCompletions:Z

    .line 306
    iput-boolean p3, p0, Lcom/android/inputmethod/latin/CandidateView;->mTypedWordValid:Z

    .line 307
    iput v1, p0, Lcom/android/inputmethod/latin/CandidateView;->mScrollX:I

    .line 308
    iput v1, p0, Lcom/android/inputmethod/latin/CandidateView;->mTargetScrollX:I

    .line 309
    iput-boolean p4, p0, Lcom/android/inputmethod/latin/CandidateView;->mHaveMinimalSuggestion:Z

    .line 310
    iput-boolean p5, p0, Lcom/android/inputmethod/latin/CandidateView;->mHaveAutoTextSuggestion:Z

    .line 312
    const/4 v0, 0x0

    invoke-virtual {p0, v0}, Lcom/android/inputmethod/latin/CandidateView;->onDraw(Landroid/graphics/Canvas;)V

    .line 313
    invoke-virtual {p0}, Lcom/android/inputmethod/latin/CandidateView;->invalidate()V

    .line 314
    invoke-virtual {p0}, Lcom/android/inputmethod/latin/CandidateView;->requestLayout()V

    .line 315
    return-void
.end method

.method public takeSuggestionAt(F)V
    .locals 4
    .parameter "x"

    .prologue
    .line 454
    float-to-int v0, p1

    iput v0, p0, Lcom/android/inputmethod/latin/CandidateView;->mTouchX:I

    .line 456
    const/4 v0, 0x0

    invoke-virtual {p0, v0}, Lcom/android/inputmethod/latin/CandidateView;->onDraw(Landroid/graphics/Canvas;)V

    .line 457
    iget-object v0, p0, Lcom/android/inputmethod/latin/CandidateView;->mSelectedString:Ljava/lang/CharSequence;

    if-eqz v0, :cond_1

    .line 458
    iget-boolean v0, p0, Lcom/android/inputmethod/latin/CandidateView;->mShowingCompletions:Z

    if-nez v0, :cond_0

    .line 459
    iget-object v0, p0, Lcom/android/inputmethod/latin/CandidateView;->mSuggestions:Ljava/util/List;

    const/4 v1, 0x0

    invoke-interface {v0, v1}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Ljava/lang/CharSequence;

    iget-object v1, p0, Lcom/android/inputmethod/latin/CandidateView;->mSelectedString:Ljava/lang/CharSequence;

    invoke-static {v0, v1}, Lcom/android/inputmethod/latin/TextEntryState;->acceptedSuggestion(Ljava/lang/CharSequence;Ljava/lang/CharSequence;)V

    .line 461
    :cond_0
    iget-object v0, p0, Lcom/android/inputmethod/latin/CandidateView;->mService:Lcom/android/inputmethod/latin/LatinIME;

    iget v1, p0, Lcom/android/inputmethod/latin/CandidateView;->mSelectedIndex:I

    iget-object v2, p0, Lcom/android/inputmethod/latin/CandidateView;->mSelectedString:Ljava/lang/CharSequence;

    invoke-virtual {v0, v1, v2}, Lcom/android/inputmethod/latin/LatinIME;->pickSuggestionManually(ILjava/lang/CharSequence;)V

    .line 463
    :cond_1
    invoke-virtual {p0}, Lcom/android/inputmethod/latin/CandidateView;->invalidate()V

    .line 464
    iget-object v0, p0, Lcom/android/inputmethod/latin/CandidateView;->mHandler:Landroid/os/Handler;

    iget-object v1, p0, Lcom/android/inputmethod/latin/CandidateView;->mHandler:Landroid/os/Handler;

    const/4 v2, 0x2

    invoke-virtual {v1, v2}, Landroid/os/Handler;->obtainMessage(I)Landroid/os/Message;

    move-result-object v1

    const-wide/16 v2, 0xc8

    invoke-virtual {v0, v1, v2, v3}, Landroid/os/Handler;->sendMessageDelayed(Landroid/os/Message;J)Z

    .line 465
    return-void
.end method
